import java.io.*;
import java.util.*;

public class GroupProfileLoader  {

    private Hashtable myHashTable = new Hashtable();
    private String fileName = null;

    public static void main( String args[] )
    {
	Hashtable localHashTable = new Hashtable();
	GroupProfileLoader loader = new GroupProfileLoader();
	loader.setFileName("./Data/Group/IndustryGroup.txt");
	loader.loadProfile();
	localHashTable = loader.getHashTable();
	loader.printHashTable(localHashTable);
    }

    public void setFileName(String file_name) {
	fileName = file_name;
    }

    public void loadProfile () {
	
	File name = new File(fileName);

	if ( !name.exists() ) {
	    System.out.println("File:"+name.getName()+" not found!");
	    return;
	}

	if ( name.isFile() ) {
	    try {
		RandomAccessFile r =  new RandomAccessFile( name, "r" );
		String text;

		while(( text = r.readLine() ) != null) {
		    StringTokenizer tokens = new StringTokenizer(text, "\t");
		    while (tokens.hasMoreTokens()) {
			myHashTable.put((String)tokens.nextToken().trim(),(String)tokens.nextToken().trim());
		    }
		}
	   }
	   catch( IOException e ) {

	   }
       }
    }

    public Hashtable getHashTable () {
	return myHashTable;
    }

    public void printHashTable ( Hashtable hashTab) {

	String key1 = null;
	Enumeration enum = hashTab.keys();

	int i = 0;
	while (enum.hasMoreElements()) {
	    i++;
	    enum.nextElement();
	    if (hashTab.containsKey(Integer.toString(i))) {
		System.out.println(i+"\t"+hashTab.get(Integer.toString(i)));
	    }
	}
    }
}




